<!--
 * @Author: yan_hai_dong 891236760@qq.com
 * @Date: 2022-08-04 13:18:25
 * @LastEditors: yan_hai_dong 891236760@qq.com
 * @LastEditTime: 2022-08-04 18:54:58
 * @FilePath: \app\src\views\el\lodash\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="lodash">
    <el-button @click="throttleClick(11)">节流点击</el-button>
    <el-button @click="debounceClick">防抖点击</el-button>
  </div>
</template>

<script>
import lodash from "lodash";
export default {
  methods: {
    throttleClick: lodash.throttle(
      (a) => {
        console.log('触发节流',a);
      },
      1000,
    //   { leading: true }
    ),
    debounceClick: lodash.debounce(
      () => {
        console.log('触发防抖');
      },
      1000,
      { leading: true }
    ),
  },
};
</script>

<style lang="less" scoped>
</style>